package App.Service;

import App.Model.Account.CrmUser;
import App.Repository.ChatRepository;
import App.Repository.DemoRepository;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManagerFactory;
import java.util.List;

/**
 * Created by xw on 2019/1/29.
 */

@Service
public class DemoService {

    @Autowired
    private DemoRepository _repository;

    public List<CrmUser> findUsersNoPage() {

        return _repository.findUsersNoPage();

    }


    private SessionFactory hibernateFactory;

    @Autowired
    public void SomeService(EntityManagerFactory factory) {
        if(factory.unwrap(SessionFactory.class) == null){
            throw new NullPointerException("factory is not a hibernate factory");
        }
        this.hibernateFactory = factory.unwrap(SessionFactory.class);


    }


}
